package com.zdb.demo.design.pattern.behavioral.interpreter;

public class OperatorUtil {

    public static boolean isOperatorString(String str) {
        return "+".equals(str) || "*".equals(str);
    }

    public static Interpreter getExpressionObject(Interpreter first, Interpreter second, String symbol) {
        switch (symbol) {
            case "+":
                return new AddInterpreter(first, second);
            case "*":
                return new MultiInterpreter(first, second);
            default:
                return null;
        }
    }
}
